Make the constraints demo more interesting
authorMatthias Clasen <mclasen@redhat.com>
Wed, 26 Jun 2019 02:35:15 +0000 (02:35 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Sun, 30 Jun 2019 22:42:44 +0000 (23:42 +0100)
Add a max size to the buttons, to force the
space to open up.

demos/gtk-demo/constraints.c

index ba13f9b00ff1fac98d674c8695d46da30b861ca4..708414f435d5d30b18b0e9abc3ed7f1f18eb632e 100644 (file)
@@ -84,6 +84,12 @@ build_constraints (SimpleGrid          *self,
                         NULL);
   gtk_constraint_layout_add_guide (manager, guide);
 
+  gtk_constraint_layout_add_constraint (manager,
+    gtk_constraint_new_constant (GTK_CONSTRAINT_TARGET (self->button1),
+                        GTK_CONSTRAINT_ATTRIBUTE_WIDTH,
+                        GTK_CONSTRAINT_RELATION_LE,
+                        200.0,
+                        GTK_CONSTRAINT_STRENGTH_REQUIRED));
   gtk_constraint_layout_add_constraint (manager,
     gtk_constraint_new (NULL,
                         GTK_CONSTRAINT_ATTRIBUTE_START,